package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	BuyOrderStatusEventNew           = "erp.BuyOrderStatusNew"
	BuyOrderStatusEventBeforeCreate  = "erp.BuyOrderStatusBeforeCreate"
	BuyOrderStatusEventBeforeUpdate  = "erp.BuyOrderStatusBeforeUpdate"
	BuyOrderStatusEventBeforeSave    = "erp.BuyOrderStatusBeforeCreate erp.BuyOrderStatusBeforeUpdate"
	BuyOrderStatusEventAfterCreate   = "erp.BuyOrderStatusAfterCreate"
	BuyOrderStatusEventAfterUpdate   = "erp.BuyOrderStatusAfterUpdate"
	BuyOrderStatusEventAfterSave     = "erp.BuyOrderStatusAfterCreate erp.BuyOrderStatusAfterUpdate"
	BuyOrderStatusEventDelete        = "erp.BuyOrderStatusDelete"
	BuyOrderStatusAccessControlEvent = "erp.BuyOrderStatusAccessControl"
)

func GetBuyOrderStatusConfig() *mgo.DocConfig {
	return BuyOrderStatus_Config
}

var BuyOrderStatus_Config *mgo.DocConfig

func init() {
	BuyOrderStatus_Config = NewBuyOrderStatusConfig()
}
func NewBuyOrderStatusConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.BuyOrderStatus",
		Fields: []string{
			"name", "sort", "l", "r", "level", "link", "parent", "children", "color", "background", "group", "step", "warn",
		},
		RelationFields: []string{
			"parent", "children",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"parent": {
				Config:     GetBuyOrderStatusConfig,
				DocName:    "BuyOrderStatus",
				JoinType:   "O",
				KeyInside:  "parentId",
				KeyOutSide: "id",
			},
			"children": {
				Config:     GetBuyOrderStatusConfig,
				DocName:    "BuyOrderStatus",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "parentId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
